package day03;

public class Shiyijian {
	public static void main(String []args) {
		Market wom=new Market();
		Thread Jac =new Thread(new Runnable() {
			@Override
			public void run() {
				wom.shop("我");				
			}			
		});
		Thread Mac=new Thread(new Runnable() {

			@Override
			public void run() {
				wom.shop("你");				
			}
			
		});
		Jac.start();
		Mac.start();
	}
}
class Market{
	public void shop(String name)   {
		System.out.println(name+":挑衣服");
		synchronized(this) {
			System.out.println(name+"：试衣服");
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.println(name+":试完衣服");
		}
		System.out.println(name+":结账买衣服");
	}
}
